home *** CD-ROM | disk | FTP | other *** search
/ New Perspectives on Computer Concepts / New Perspectives on Computer Concepts.iso / np2010c / page775.pag < prev    next >
Portable Network Graphic  |  2008-10-02  |  58KB  |  817x1045  |  8-bit (256 colors)
Labels: hakham | monitor | sky
OCR: COMPUTER PROGRAMMING 707 How does the getArea() method work? If you have been thinking ahead bit you might wonder how programmer can define the getArea( method to perform two different calculations- -one that calculates the area rectangle by multiplying its length times its width and another that cal- culates the area of a circle using the formula Ttr2. An object -oriented con- cept called polymorphism makes possible to assign more than one formula to the getArea method What is polymorphism? Polymorphism, sometimes called overload- ing, the ability to redefine a method in subclass. allows programmers to create single generic name for procedure that behaves n unique ways different classes In the pizza program, for example both the RectanglePizza and RoundPizza classes can have getArea( meth ...